<template>
  <div class="home">
    <h1 style="text-align: center;">双击可修改</h1>
    <div id="tab">
      <div class="tabNav" id="tabNav">
        <ul>
          <li class="active">
            <span>测试1</span>
            <span>X</span>
          </li>
          <li>
            <span>测试2</span>
            <span>X</span>
          </li>
          <li>
            <span>测试3</span>
            <span>X</span>
          </li>
        </ul>
        <div id="add">
          <span>+</span>
        </div>
      </div>
      <div class="tabContent" id="tabContent">
        <div class="contactive">
          <span>测试1</span>
        </div>
        <div>
          <span>测试2</span>
        </div>
        <div>
          <span>测试3</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Tab from "../assets/JS/tab";
export default {
  name: "Home",
  mounted() {
    var tab = document.getElementById("tab");
    new Tab(tab);
  },
};
</script>
<style lang="scss" scoped>
ul {
  list-style: none;
}
#tab {
  width: 600px;
  height: 400px;
  border: 1px solid #ccc;
  margin: 50px auto;
}
#tabNav {
  width: 100%;
  height: 50px;
  border-bottom: 1px solid red;
  position: relative;
  #add {
    position: absolute;
    top: 10px;
    font-size: 28px;
    right: 0;
    span {
      padding: 3px;
      border: 1px solid #000;
      user-select: none;
      cursor: pointer;
    }
  }
  /deep/ul {
    display: flex;
    align-items: center;
    height: 100%;
    /deep/li {
      width: 100px;
      height: 100%;
      line-height: 50px;
      cursor: pointer;
      text-align: center;
      position: relative;
      /deep/input {
        width: 80px;
      }
      span:last-child {
        position: absolute;
        top: -17px;
        right: 0;
      }
    }
    .active {
      border: 1px solid blue;
    }
  }
}
#tabContent {
  width: 100%;
  height: 350px;
  /deep/div {
    height: 100%;
    display: none;
    cursor: pointer;
  }
  /deep/input {
    width: 300px !important;
    height: 200px;
  }
  /deep/.contactive {
    display: block;
  }
}
</style>